App = Ember.Application.create({
    LOG_TRANSITIONS: true,
    LOG_ACTIVE_GENERATION: true,
});
App.Store = DS.Store.extend({
  adapter: DS.FixtureAdapter.create()
});

App.Router.map(function() {
  // put your routes here
});

App.IndexRoute = Ember.Route.extend({
  model: function() {
    return this.get('store').find('person', 1);
  }
});

/********************************************************************************/
// Models
/********************************************************************************/

App.Person = DS.Model.extend({
    user: DS.attr('string'),
    name: DS.attr('string'),
    team: DS.belongsTo('team'),
    isAdmin: DS.attr('boolean')
});

App.Resource = DS.Model.extend({
    name: DS.attr('string'),
    team: DS.belongsTo('team'),
    inUseBy: DS.belongsTo('person')
});

App.Team = DS.Model.extend({
    name: DS.attr('string'),
    persons: DS.hasMany('person'),
    resources: DS.hasMany('resource')
});

/********************************************************************************/
// Fixtures
/********************************************************************************/
App.Person.FIXTURES = [{
    id: 1,
    user: "t_bot",
    name: "bot",
    team: 1,
    isAdmin: true
}];

App.Resource.FIXTURES = [{
    id: 1,
    name: "resource 1",
    team: 1,
    inUseBy: null,
}, {
    id: 2,
    name: "resource 2",
    team: 2,
    inUseBy: null,
}];

App.Team.FIXTURES = [{
    id: 1,
    name: "awesome team",
    persons: [1, ],
    resources: [1, ]
}];